package org.joseph.springcloud.api;

import feign.hystrix.FallbackFactory;
import org.joseph.springcloud.pojo.User;
import org.springframework.stereotype.Component;

@Component
public class UserClientServiceFallbackFactory implements FallbackFactory {

    @Override
    public Object create(Throwable throwable) {
        return new UserService() {

            public User queryById(long id) {
                return new User().setId(0L).setUsername("queryById:没有id="+id+"的数据");
            }

            @Override
            public User getUser(long id) {
                return new User().setId(0L).setUsername("getUser:没有id="+id+"的数据");
            }
        };
    }
}
